package com.ruoyi.user.controller.app;


import com.ruoyi.common.core.constant.constant.PathConstant;
import com.ruoyi.common.core.pojo.vo.SingleVO;
import com.ruoyi.common.core.pojo.vo.TokenVO;
import com.ruoyi.common.core.result.Result;
import com.ruoyi.user.model.pojo.request.app.LoginRequest;
import com.ruoyi.user.service.IUserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@Tag(name = "App-登录", description = "App-登录")
@RestController
@RequestMapping(PathConstant.APP_PATH + "login")
public class AppLoginController {
    private final IUserService iUserService;

    public AppLoginController(IUserService iUserService) {
        this.iUserService = iUserService;
    }


    @Operation(summary = "登录", description = "登录")
    @PostMapping("/login")
    public SingleVO<TokenVO<String>> login(@RequestBody @Validated LoginRequest loginRequest) throws Exception {
        return Result.single(iUserService.login(loginRequest));
    }






//    @Operation(tags = "找回密码")
//    @PostMapping("findWord")
//    public BaseVO findWord(@RequestBody FindPassWordRequest request) throws Exception {
//        return Result.successOrFail(iUserService.findWord(request));
//    }
//
//    @Operation(tags = "注册")
//    @PostMapping("register")
//    public BaseVO register(@RequestBody @Valid RegisterRequest request) throws Exception {
//        return Result.successOrFail(iUserService.register(request));
//    }
}
